class AddCategoryData < ActiveRecord::Migration
  def self.up
    cate = Category.create(
      :name => 'test',
      :code => 'name',
      :description => 'description'
    )
    Product.find(:all).each do |i|
      i.category = cate;
      i.save!
    end
  end

  def self.down
    Product.find(:all).each do |i|
      i.category = nil
      i.save!
    end
    Category.delete_all
  end
end
